furny.states
Class InitializerPreState

java.lang.Object
  extended by com.jme3.app.state.AbstractAppState
      extended by ga.view.appstate.RootNodeState
          extended by ga.view.appstate.SceneState
              extended by furny.states.InitializerPreState
All Implemented Interfaces:
com.jme3.app.state.AppState, IMenuListenerParent, IPreEvaluationState

public class InitializerPreState
extends SceneState
implements IPreEvaluationState

Pre state to initialize the population and show room.

Since:
12.08.2012
Author:
Stephan Dreyer

Nested Class Summary
private  class InitializerPreState.ViewSwitchListener
          Keyboard listener to switch the perspective.
 
Field Summary
private  ISIGA<FurnLayoutIndividual> algorithm
           
private  CameraSettings camSettings
           
private  CamDragListener dragListener
           
private  IInteractiveFitnessEvaluator<FurnLayoutIndividual> evaluator
           
private  FurnLayoutIndividual ind
           
private static java.util.logging.Logger LOGGER
           
private  MenuListener menuListener
           
private  IPhenotypeGenerator<FurnLayoutIndividual,com.jme3.scene.Node> phenotypeGenerator
           
private  com.jme3.system.AppSettings settings
           
private  ShowRoom showRoom
           
private  ShowRoomFactory showRoomFactory
           
private  ShowRoomSettings srSettings
           
private  InitializerUIState uiState
           
 
Fields inherited from class ga.view.appstate.SceneState
app, assetManager, cam, inputManager, renderManager, stateManager, timer, viewPort
 
Fields inherited from class ga.view.appstate.RootNodeState
rootNode
 
Fields inherited from class com.jme3.app.state.AbstractAppState
initialized
 
Constructor Summary
InitializerPreState(IInteractiveFitnessEvaluator<FurnLayoutIndividual> evaluator, ISIGA<FurnLayoutIndividual> algorithm, IPhenotypeGenerator<FurnLayoutIndividual,com.jme3.scene.Node> phenotypeGenerator)
          Instantiates a new initializer pre state.
 
Method Summary
 void cleanup()
           
 FurnLayoutIndividual getIndividual()
          Gets the current individual.
 int getPopPercentage()
          Gets the population percentage that should be initialized with the loaded individual.
 java.lang.String getPopPercentageString()
          Gets the population percentage that should be initialized with the loaded individual as string.
 int getRoomHeight()
          Gets the room height.
 int getRoomLength()
          Gets the room length.
 java.lang.String getRoomSizeString()
          Gets the room size as string.
 int getRoomWidth()
          Gets the room width.
 void initialize(com.jme3.app.state.AppStateManager stateManager, com.jme3.app.Application app)
           
 void saveSettings()
          Saves settings in the GA context.
 void setEnabled(boolean enabled)
           
 void setFloorTexture(java.lang.String name)
          Sets the floor texture.
 void setIndividual(FurnLayoutIndividual ind)
          Sets a new individual.
 void setLightingType(BoxShowRoom.LightingType lightingType)
          Sets the lighting type.
 void setMenuListener(MenuListener menuListener)
          Sets the menu listener.
 void setPopPercentage(int percentage)
          Sets the population percentage that should be initialized with the loaded individual.
 void setRoomSize(int width, int length, int height)
          Sets the room size.
 void setWallColor(com.jme3.math.ColorRGBA color)
          Sets the wall color.
 void updateShowRoom()
          Updates show room.
 
Methods inherited from class ga.view.appstate.SceneState
finalCleanUp, getCamera
 
Methods inherited from class ga.view.appstate.RootNodeState
getRootNode, update
 
Methods inherited from class com.jme3.app.state.AbstractAppState
isEnabled, isInitialized, postRender, render, stateAttached, stateDetached
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jme3.app.state.AppState
isEnabled, isInitialized, postRender, render, stateAttached, stateDetached, update
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

evaluator

private final IInteractiveFitnessEvaluator<FurnLayoutIndividual> evaluator

algorithm

private final ISIGA<FurnLayoutIndividual> algorithm

showRoomFactory

private ShowRoomFactory showRoomFactory

showRoom

private ShowRoom showRoom

srSettings

private final ShowRoomSettings srSettings

camSettings

private CameraSettings camSettings

phenotypeGenerator

private final IPhenotypeGenerator<FurnLayoutIndividual,com.jme3.scene.Node> phenotypeGenerator

dragListener

private CamDragListener dragListener

menuListener

private MenuListener menuListener

settings

private com.jme3.system.AppSettings settings

uiState

private InitializerUIState uiState

ind

private FurnLayoutIndividual ind
Constructor Detail

InitializerPreState

public InitializerPreState(IInteractiveFitnessEvaluator<FurnLayoutIndividual> evaluator,
                           ISIGA<FurnLayoutIndividual> algorithm,
                           IPhenotypeGenerator<FurnLayoutIndividual,com.jme3.scene.Node> phenotypeGenerator)
Instantiates a new initializer pre state.

Parameters:
evaluator - the evaluator
algorithm - the algorithm
phenotypeGenerator - the phenotype generator
Since:
12.08.2012
Method Detail

setMenuListener

public void setMenuListener(MenuListener menuListener)
Description copied from interface: IMenuListenerParent
Sets the menu listener.

Specified by:
setMenuListener in interface IMenuListenerParent
Parameters:
menuListener - the new menu listener

initialize

public void initialize(com.jme3.app.state.AppStateManager stateManager,
                       com.jme3.app.Application app)
Specified by:
initialize in interface com.jme3.app.state.AppState
Overrides:
initialize in class SceneState

setFloorTexture

public void setFloorTexture(java.lang.String name)
Sets the floor texture.

Parameters:
name - the new floor texture
Since:
12.08.2012

setWallColor

public void setWallColor(com.jme3.math.ColorRGBA color)
Sets the wall color.

Parameters:
color - the new wall color
Since:
12.08.2012

saveSettings

public void saveSettings()
Saves settings in the GA context.

Since:
12.08.2012

setPopPercentage

public void setPopPercentage(int percentage)
Sets the population percentage that should be initialized with the loaded individual.

Parameters:
percentage - the new pop percentage
Since:
12.08.2012

getPopPercentageString

public java.lang.String getPopPercentageString()
Gets the population percentage that should be initialized with the loaded individual as string.

Returns:
the pop percentage string
Since:
12.08.2012

getPopPercentage

public int getPopPercentage()
Gets the population percentage that should be initialized with the loaded individual.

Returns:
the pop percentage
Since:
12.08.2012

getRoomSizeString

public java.lang.String getRoomSizeString()
Gets the room size as string.

Returns:
the room size string
Since:
12.08.2012

getRoomWidth

public int getRoomWidth()
Gets the room width.

Returns:
the room width
Since:
12.08.2012

getRoomLength

public int getRoomLength()
Gets the room length.

Returns:
the room length
Since:
12.08.2012

getRoomHeight

public int getRoomHeight()
Gets the room height.

Returns:
the room height
Since:
12.08.2012

setRoomSize

public void setRoomSize(int width,
                        int length,
                        int height)
Sets the room size.

Parameters:
width - the width
length - the length
height - the height
Since:
12.08.2012

setIndividual

public void setIndividual(FurnLayoutIndividual ind)
Sets a new individual.

Parameters:
ind - the new individual
Since:
12.08.2012

getIndividual

public FurnLayoutIndividual getIndividual()
Gets the current individual.

Returns:
the individual
Since:
12.08.2012

setLightingType

public void setLightingType(BoxShowRoom.LightingType lightingType)
Sets the lighting type.

Parameters:
lightingType - the new lighting type
Since:
12.08.2012

updateShowRoom

public void updateShowRoom()
Updates show room.

Since:
12.08.2012

setEnabled

public void setEnabled(boolean enabled)
Specified by:
setEnabled in interface com.jme3.app.state.AppState
Overrides:
setEnabled in class SceneState

cleanup

public void cleanup()
Specified by:
cleanup in interface com.jme3.app.state.AppState
Overrides:
cleanup in class RootNodeState